package cn.sollyu.SDCardManager;

import java.io.File;

import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

public class ActivityViewAlertDialgo extends AlertDialog
{	
	public ActivityViewAlertDialgo(Context context, File nowSelecteFile) {
		super(context);
		View view = getLayoutInflater().inflate(R.layout.activity_view, null);

		setTitle(nowSelecteFile.getName());
		setIcon(ServiceFileManager.getFileIcon(nowSelecteFile.getAbsolutePath()));
		
		((TextView)view.findViewById(R.id.view_activity_textView_info)).setText(ServiceDatabaseManager.getInfoString(nowSelecteFile.getAbsolutePath(), context));
		((TextView)view.findViewById(R.id.view_activity_textView_dele)).setText(ServiceDatabaseManager.getDeleInfoString(nowSelecteFile.getAbsolutePath(), context));
		((TextView)view.findViewById(R.id.view_activity_textView_soft)).setText(ServiceDatabaseManager.getSoftString(nowSelecteFile.getAbsolutePath(), context));
		
		try
		{
			if (nowSelecteFile.isDirectory()) {
				((TextView)view.findViewById(R.id.view_activity_textView_size)).setText(ServiceFileManager.FormetFileSize(ServiceFileManager.getFileSize(nowSelecteFile)) );
			}
			else {
				((TextView)view.findViewById(R.id.view_activity_textView_size)).setText(ServiceFileManager.FormetFileSize(ServiceFileManager.getFileSizes(nowSelecteFile)) );
			}
		} catch (Exception e)
		{
			e.printStackTrace();
		}
		
		TextView indexTextView = (TextView)view.findViewById(R.id.view_activity_textView_index);
		indexTextView.setText(context.getResources().getStringArray(R.array.edit_activity_spinner_index)[new Integer(ServiceDatabaseManager.getDeleIndexString(nowSelecteFile.getAbsolutePath(), context)) -1]);
		
		
		setButton("确定", (OnClickListener) null);
		setView(view);
		
		
		
	}

	

	
	
}
